package com.hy.mydesktop.client.component.factory;


import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.hy.mydesktop.client.component.meta.TableLayoutModelEnum;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentMetaNodeModel;
/**
 * 
 * <ul>
 * <li>开发作者：冬超</li>
 * <li>设计日期：2010-8-31；时间：下午03:08:11</li>
 * <li>类型名称：TableLayoutFactory</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
public class TableLayoutFactory {
	public static TableLayout createTableLayout(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		return configureTableLayout(gxtComponentMetaNodeModel);

	}

	private static TableLayout configureTableLayout(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		TableLayout tableLayout = createDefaultTableLayout();
		if (gxtComponentMetaNodeModel.get(TableLayoutModelEnum.COLUMNS.name()
				.toLowerCase()) != null) {
			Integer columns = (Integer) gxtComponentMetaNodeModel
					.get(TableLayoutModelEnum.COLUMNS.name().toLowerCase());
			tableLayout.setColumns(columns);

		}
			
		return tableLayout;
	}

	private static TableLayout createDefaultTableLayout() {

		TableLayout tableLayout = new TableLayout();

		return tableLayout;
	}
}
